home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / JAVA Utilities / JProxy 1.1.0 / SAMPLES.JAR / com / jproxy / samples / rmi / test / TestImpl_Stub.java < prev    next >
Encoding:
Java Source  |  2003-04-29  |  3.9 KB  |  120 lines

  1. // Stub class generated by rmic, do not edit.
  2. // Contents subject to change without notice.
  3.  
  4. package com.jproxy.samples.rmi.test;
  5.  
  6. public final class TestImpl_Stub
  7.     extends java.rmi.server.RemoteStub
  8.     implements com.jproxy.samples.rmi.test.TestRmi, java.rmi.Remote
  9. {
  10.     private static final java.rmi.server.Operation[] operations = {
  11.     new java.rmi.server.Operation("byte echoBytes(byte[])[]"),
  12.     new java.rmi.server.Operation("long getServerTime()")
  13.     };
  14.     
  15.     private static final long interfaceHash = 3274809350234753702L;
  16.     
  17.     private static final long serialVersionUID = 2;
  18.     
  19.     private static boolean useNewInvoke;
  20.     private static java.lang.reflect.Method $method_echoBytes_0;
  21.     private static java.lang.reflect.Method $method_getServerTime_1;
  22.     
  23.     static {
  24.     try {
  25.         java.rmi.server.RemoteRef.class.getMethod("invoke",
  26.         new java.lang.Class[] {
  27.             java.rmi.Remote.class,
  28.             java.lang.reflect.Method.class,
  29.             java.lang.Object[].class,
  30.             long.class
  31.         });
  32.         useNewInvoke = true;
  33.         $method_echoBytes_0 = com.jproxy.samples.interfaces.ITest.class.getMethod("echoBytes", new java.lang.Class[] {byte[].class});
  34.         $method_getServerTime_1 = com.jproxy.samples.interfaces.ITest.class.getMethod("getServerTime", new java.lang.Class[] {});
  35.     } catch (java.lang.NoSuchMethodException e) {
  36.         useNewInvoke = false;
  37.     }
  38.     }
  39.     
  40.     // constructors
  41.     public TestImpl_Stub() {
  42.     super();
  43.     }
  44.     public TestImpl_Stub(java.rmi.server.RemoteRef ref) {
  45.     super(ref);
  46.     }
  47.     
  48.     // methods from remote interfaces
  49.     
  50.     // implementation of echoBytes(byte[])
  51.     public byte[] echoBytes(byte[] $param_arrayOf_byte_1)
  52.     throws java.rmi.RemoteException
  53.     {
  54.     try {
  55.         if (useNewInvoke) {
  56.         Object $result = ref.invoke(this, $method_echoBytes_0, new java.lang.Object[] {$param_arrayOf_byte_1}, -3791006001307315080L);
  57.         return ((byte[]) $result);
  58.         } else {
  59.         java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 0, interfaceHash);
  60.         try {
  61.             java.io.ObjectOutput out = call.getOutputStream();
  62.             out.writeObject($param_arrayOf_byte_1);
  63.         } catch (java.io.IOException e) {
  64.             throw new java.rmi.MarshalException("error marshalling arguments", e);
  65.         }
  66.         ref.invoke(call);
  67.         byte[] $result;
  68.         try {
  69.             java.io.ObjectInput in = call.getInputStream();
  70.             $result = (byte[]) in.readObject();
  71.         } catch (java.io.IOException e) {
  72.             throw new java.rmi.UnmarshalException("error unmarshalling return", e);
  73.         } catch (java.lang.ClassNotFoundException e) {
  74.             throw new java.rmi.UnmarshalException("error unmarshalling return", e);
  75.         } finally {
  76.             ref.done(call);
  77.         }
  78.         return $result;
  79.         }
  80.     } catch (java.lang.RuntimeException e) {
  81.         throw e;
  82.     } catch (java.rmi.RemoteException e) {
  83.         throw e;
  84.     } catch (java.lang.Exception e) {
  85.         throw new java.rmi.UnexpectedException("undeclared checked exception", e);
  86.     }
  87.     }
  88.     
  89.     // implementation of getServerTime()
  90.     public long getServerTime()
  91.     throws java.rmi.RemoteException
  92.     {
  93.     try {
  94.         if (useNewInvoke) {
  95.         Object $result = ref.invoke(this, $method_getServerTime_1, null, 7800110265884817733L);
  96.         return ((java.lang.Long) $result).longValue();
  97.         } else {
  98.         java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject) this, operations, 1, interfaceHash);
  99.         ref.invoke(call);
  100.         long $result;
  101.         try {
  102.             java.io.ObjectInput in = call.getInputStream();
  103.             $result = in.readLong();
  104.         } catch (java.io.IOException e) {
  105.             throw new java.rmi.UnmarshalException("error unmarshalling return", e);
  106.         } finally {
  107.             ref.done(call);
  108.         }
  109.         return $result;
  110.         }
  111.     } catch (java.lang.RuntimeException e) {
  112.         throw e;
  113.     } catch (java.rmi.RemoteException e) {
  114.         throw e;
  115.     } catch (java.lang.Exception e) {
  116.         throw new java.rmi.UnexpectedException("undeclared checked exception", e);
  117.     }
  118.     }
  119. }
  120.